<script>
	import Vue from 'vue' // 下面处理手机顶部状态栏时才会用到这个
	export default {
		onLaunch: function() {
			//一旦进入了app,就需要执行这个方法,把用户信息读出来
			this.$store.commit('user/initUser');
			// 尝试提取本地存储用户信息,这里尽量简化，更多内容放具体功能处展开
			/* try {
				const value = uni.getStorageSync('userInfo');
				if (value) {
					this.$store.commit('user/initInfo',value)
				}
			} catch (e) {
				// error
				console.log('提取用户信息失败');
			} */
			
			// 处理手机顶部状态栏兼容问题
			uni.getSystemInfo({
				success: function(e) {
					// #ifndef MP
					Vue.prototype.StatusBar = e.statusBarHeight;
					if (e.platform == 'android') {
						Vue.prototype.CustomBar = e.statusBarHeight + 50;
					} else {
						Vue.prototype.CustomBar = e.statusBarHeight + 45;
					};
					// #endif
			
					// #ifdef MP-WEIXIN
					Vue.prototype.StatusBar = e.statusBarHeight;
					let custom = wx.getMenuButtonBoundingClientRect();
					Vue.prototype.Custom = custom;
					Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
					// #endif		
			
					// #ifdef MP-ALIPAY
					Vue.prototype.StatusBar = e.statusBarHeight;
					Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
					// #endif
				}
			})
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "common/main.css";
	@import "common/icon.css";
	@import "common/iconfont.css";
	@import "common/common.css";
	@import "@/uni_modules/uview-ui/index.scss";
	/* @import "@/common/demo.scss"; */
</style>
